home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.app;
-
- import com.extensibility.util.RuleSplitPane;
- import java.awt.Component;
- import java.awt.Container;
- import javax.swing.JComponent;
- import javax.swing.SwingUtilities;
- import javax.swing.border.Border;
-
- public class CompositeManager {
- RuleSplitPane botSplit;
- RuleSplitPane leftSplit;
- int botRule = 130;
- int leftRule = 175;
- Pane botPane;
- Pane leftPane;
- Pane mainPane;
- Container container;
- JComponent contentCenter;
-
- public CompositeManager(Container var1, Pane var2) {
- this.container = var1;
- this.mainPane = var2;
- if (this.getMainPane() != null) {
- this.addAsContentPaneCenter(this.getMainPane().getComponent());
- }
-
- }
-
- public CompositeManager(Container var1, Pane var2, Pane var3, Pane var4) {
- this.container = var1;
- this.leftPane = var2;
- this.mainPane = var3;
- this.botPane = var4;
- if (this.getMainPane() != null) {
- this.addAsContentPaneCenter(this.getMainPane().getComponent());
- }
-
- }
-
- public void addAsContentPaneCenter(JComponent var1) {
- if (this.contentCenter != var1) {
- if (this.contentCenter != null) {
- this.container.remove(this.contentCenter);
- }
-
- this.container.add(var1);
- this.contentCenter = var1;
- }
- }
-
- public Pane getFocusedPane() {
- Object var1 = null;
-
- for(Object var2 = SwingUtilities.findFocusOwner(this.container); var2 != null; var2 = ((Component)var2).getParent()) {
- if (var2 == this.getMainComponent()) {
- return this.getMainPane();
- }
-
- if (var2 == this.getLeftComponent()) {
- return this.getLeftPane();
- }
-
- if (var2 == this.getBottomComponent()) {
- return this.getBottomPane();
- }
- }
-
- return this.getMainPane();
- }
-
- public boolean showHideBottomPane(boolean var1) {
- if (var1 == this.isBotPaneVisible()) {
- return true;
- } else {
- Object var2 = this.isLeftPaneVisible() ? this.leftSplit : this.getMainComponent();
- if (var1) {
- if (!this.getBottomPane().addRequest()) {
- return false;
- }
-
- this.botSplit = new RuleSplitPane(0, (Component)var2, this.getBottomComponent());
- this.botSplit.setBorder((Border)null);
- this.botSplit.setDividerRule(false, this.botRule);
- this.addAsContentPaneCenter(this.botSplit);
- this.container.validate();
- this.botSplit.resetDividerLoc();
- } else {
- if (!this.getBottomPane().removeRequest()) {
- return false;
- }
-
- this.botRule = this.botSplit.getDividerRulePos();
- this.botSplit = null;
- this.addAsContentPaneCenter((JComponent)var2);
- this.container.validate();
- }
-
- return true;
- }
- }
-
- public boolean showHideLeftPane(boolean var1) {
- if (var1 == this.isLeftPaneVisible()) {
- return true;
- } else if (var1 && !this.getLeftPane().addRequest()) {
- return false;
- } else if (!var1 && !this.getLeftPane().removeRequest()) {
- return false;
- } else {
- if (this.isBotPaneVisible()) {
- if (var1) {
- this.leftSplit = new RuleSplitPane(1, this.getLeftComponent(), this.getMainComponent());
- this.leftSplit.setBorder((Border)null);
- this.leftSplit.setDividerRule(true, this.leftRule);
- this.botSplit.setLeftComponent(this.leftSplit);
- } else {
- this.leftRule = this.leftSplit.getDividerRulePos();
- this.leftSplit = null;
- this.botSplit.setLeftComponent(this.getMainComponent());
- }
-
- this.botSplit.resetDividerLoc();
- } else if (var1) {
- this.leftSplit = new RuleSplitPane(1, this.getLeftComponent(), this.getMainComponent());
- this.leftSplit.setBorder((Border)null);
- this.leftSplit.setDividerRule(true, this.leftRule);
- this.addAsContentPaneCenter(this.leftSplit);
- this.container.validate();
- this.leftSplit.resetDividerLoc();
- } else {
- this.leftRule = this.leftSplit.getDividerRulePos();
- this.leftSplit = null;
- this.addAsContentPaneCenter(this.getMainComponent());
- this.container.validate();
- }
-
- return true;
- }
- }
-
- public boolean isBotPaneVisible() {
- return this.botSplit != null;
- }
-
- public boolean isLeftPaneVisible() {
- return this.leftSplit != null;
- }
-
- public Pane getBottomPane() {
- return this.botPane;
- }
-
- public JComponent getBottomComponent() {
- return this.botPane == null ? null : this.botPane.getComponent();
- }
-
- public Pane getLeftPane() {
- return this.leftPane;
- }
-
- public JComponent getLeftComponent() {
- return this.leftPane == null ? null : this.leftPane.getComponent();
- }
-
- public Pane getMainPane() {
- return this.mainPane;
- }
-
- public JComponent getMainComponent() {
- return this.mainPane.getComponent();
- }
-
- public boolean setMainPane(Pane var1) {
- if (var1 == this.getMainPane()) {
- return true;
- } else if (this.getMainPane() != null && !this.getMainPane().removeRequest()) {
- return false;
- } else if (!var1.addRequest()) {
- return false;
- } else {
- if (this.isLeftPaneVisible()) {
- this.leftSplit.setRightComponent(var1.getComponent());
- this.leftSplit.resetDividerLoc();
- } else if (this.isBotPaneVisible()) {
- this.botSplit.setLeftComponent(var1.getComponent());
- this.botSplit.resetDividerLoc();
- } else {
- this.addAsContentPaneCenter(var1.getComponent());
- this.container.validate();
- var1.getComponent().repaint();
- }
-
- this.mainPane = var1;
- this.mainPane.requestFocus();
- return true;
- }
- }
-
- public void setLeftPane(Pane var1) {
- if (this.isLeftPaneVisible()) {
- this.leftSplit.setLeftComponent(var1.getComponent());
- this.leftSplit.resetDividerLoc();
- }
-
- this.leftPane = var1;
- }
-
- public void setBottomPane(Pane var1) {
- if (this.isBotPaneVisible()) {
- this.botSplit.setRightComponent(var1.getComponent());
- this.botSplit.resetDividerLoc();
- }
-
- this.botPane = var1;
- }
- }
-